![]() |
| What is Constant,Variable and Datatype in C ? |
Upon Completing this article,you will be able to:
- Know the Character Set, C Token and Keywords.
- Describe Constant and Variable.
- Identifying the various C data types.
Character Set in C:-
- Letters
- Digits
- Specials Character
- White Space
Tokens in C:-
- Keyword
- Identifiers
- Constant
- Strings
- Specials Symbols
- Operators
Keywords in C:-
There are 32 Keywords are available in C-language
Indentifiers in C:-
An identifiers refer to the names of the variables,function and array.These are user defined names and consist of sequence of letters and digits with a letter as the first character.
Both uppercase and lowercase letters are permitted,although lowercase letters commonly used.The underscore character is also permitted in identifiers.It is usually used as link between two words in long identifiers.
Rules For Identifiers:-
- First character must be an alphabet(or underscore).
- Must consist of only letters,digits or underscore.
- Only first 31 character are significant.
- Cannot use a keyword.
- Must not contain white space.
Constants in C:-
Constants in C language refer to fixed values that do not change during the execution of a program.C support several types of constants as illustrated in fig
- If you want to learn about Constants of C in details than tap on above image and goto next article where are constants are define in details.
- String,Specials Symbols and operator are discussed as and when they are encountered.
Variables in C:-
A variable is data name that may be used to store data value. Unlike constant that remain unchanged during the execution of a program.a variable may take different value at different times during execution.
A variables name can be chosen by the programmer in a meaningful way so as to reflect its function or nature in the program.Some example of such names are :average,height,total,count etc.
Rules for Variable:
- They must begin with a letter.Some system permit underscore as the first character.
- ANSI standard recognizes a length of 31 character.
- Uppercase and lowercase are significant.
- It should not a keyword,
- White space is not allowed.
Data Type:-
C language rich in data type,Storage representation and machine instruction to handle constants differ from machine to machine. The variety of data types available allow the programmer to select the appropriate to the need of the application as well as the machine.
ANSI C support three classes of data type:
- Primary(or fundamental) data type
- Derived data type
- User defined data type
The Primary Data type:-
The primary data type are also know as primitive or fundamentals data type of C language.All C compiler support five fundamental data type,namely integer(int),character(char),floating point(float),double precision floating point(double) and void.
- If you want to learnt about primary data type in details than click on above image and goto next article where primary data type define in details with example.
- The user defined data type are defined in the next section while derived data type such as array,function,structure and pointer are discussed as and when they are encountered.


